<!doctype html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>添加标签</title>

    <!-- css -->
    <link rel="stylesheet" href="../../static/layui-v2.5.4/layui/css/layui.css" th:href="@{/layui-v2.5.4/layui/css/layui.css}">
    <link rel="stylesheet" href="../../static/blog/css/style.css" th:href="@{/blog/css/style.css}">

    <!-- js -->
    <script src="../../static/layui-v2.5.4/layui/layui.js" th:src="@{/layui-v2.5.4/layui/layui.js}"></script>

</head>
<body>
<div class="tag-container">
    <div class="layui-container">
        <form class="layui-form" action="/v1/admin/tag" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">标签名</label>
                <div class="layui-input-inline">
                    <input type="text" name="tagName" required  lay-verify="required" placeholder="标签名" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">标签描述</label>
                <div class="layui-input-inline">
                    <input type="text" name="description" required lay-verify="required" placeholder="请输入标签描述" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="tagForm">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script>
    layui.use('form', function(){
        var form = layui.form;
        //监听提交
        form.on('submit(tagForm)', function(data){
            var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
            // 关闭父窗口
            parent.layer.close(index);
            // 在父层弹出一个层
            parent.layer.msg('标签添加成功，请刷新', {icon: 1});
            return true;
        });
    });
</script>
</body>
</html>